<!--
 * @docName: entAccountManagementDetails.vue
 * @Author: mwl
 * @Date: 14:23
 * @LastEditors: mwl
 * @LastEditTime: 14:23
-->
<template>
  <div>
    <div class=info-details>
      <div class="card-title">
        <span>企业详情</span>
        <a-button @click="goBack" type="primary">更换充值企业</a-button>
      </div>
      <div class='info-content'>
        <a-row type="flex" justify="space-between">
          <a-col :span="10" style='padding: 10px 0'>
            充值企业：{{entDetailBase.entName}}
          </a-col>
          <a-col :span="10" style='padding: 10px 0'>
            社会统一信用代码：{{entDetailBase.lisenceCreditCode}}
          </a-col>
          <a-col :span="10" style='padding: 10px 0'>
            法人姓名：{{entDetailBase.legalName}}
          </a-col>
          <a-col :span="10" style='padding: 10px 0'>
            法人身份证号码：{{entDetailBase.cardNumber}}
          </a-col>
        </a-row>
      </div>
    </div>
    <a-tabs default-active-key="1" v-model="activeKey" @change="callback">
      <a-tab-pane key="1" tab="通用账户充值">
        <universalAccountDetails :key="timer"></universalAccountDetails>
      </a-tab-pane>
      <a-tab-pane key="2" tab="税费账户充值">
        <taxAccountDetails :key="timer"></taxAccountDetails>
      </a-tab-pane>
    </a-tabs>
  </div>
</template>

<script>
import universalAccountDetails from '@views/myAccount/modules/universalAccountDetails';
import taxAccountDetails from '@views/myAccount/modules/taxAccountDetails';
import { getEqueryEntDetail } from '@api/account'
export default {
  name: 'entAccountManagementDetails',
  components:{
    universalAccountDetails,
    taxAccountDetails
  },
  data(){
    return{
      infoDetails:{},
      entDetailBase:{},
      activeKey: '1',
      timer: null,
    }
  },
  created() {

  },
  mounted() {
    this.showtabs() //跳转到指定tab
    this.getEqueryEntDetailFun();
  },
  methods:{
    async callback(key) {
      //
      this.activeKey = key
      //刷新子组件
      this.timer = new Date().getTime()
    },
    getEqueryEntDetailFun(){
      let params = {};
      params.entId = this.$route.query.bizId;
      getEqueryEntDetail(params).then(res => {
        if (res.success) {
          // // 赋值表格数据
          this.infoDetails = res.result;
          if(res.result.entDetailBase){
            this.entDetailBase = res.result.entDetailBase;
            localStorage.setItem('entDetailBase', JSON.stringify(this.entDetailBase));
          }
          this.loading = false;
        }else{
          this.$message.warning(res.message)
        }
      })
    },
    showtabs() {
      if (this.$route.query.pagetab) {
        this.activeKey = this.$route.query.pagetab
      }
    },
    goBack() {
      this.$router.go(-1)
    },
  }
}
</script>

<style scoped lang='less'>
.info-details{
  background: #fff;
  box-sizing: border-box;
  padding:10px 20px;
  height: 100%;
  .card-title {
    display: flex;
    justify-content: space-between;
    align-content: center;
    align-items: center;
    font-size: 20px;
    font-weight: 600;
    color: #222;
  }
  .info-content{
    padding: 20px 0;
  }
}

</style>
